package com.wuhuahe.learning.lagou.service.stream.producer.service.impl;

import com.wuhuahe.learning.lagou.service.stream.producer.service.IMessageProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.support.MessageBuilder;

@EnableBinding(value = Source.class)
public class MessageProducerImpl implements IMessageProducer {

    @Autowired
    private Source source;


    @Override
    public void send(String content) {
        source.output().send(MessageBuilder.withPayload(content).build());
    }
}
